<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>以太坊钱包地址生成器</title>
</head>
<body>
    <h1>纯JS版本以太坊冷钱包生成工具,不泄密,无后台,不放心请手机断网操作</h1>
    设置密码 : <input type="text" name="fname" id="fname" value="123456"  />
    <button onclick="generateWallet()">生成钱包</button> 
    <br /><br />以太坊钱包 :  <div id="walletAddress"></div>
    <br />私钥： <div id="privateKey"></div>
    <!-- 引入 keythereum.min.js -->
    <script src="keythereum.js"></script>
    <script>
        function generateWallet() {
            var params = { keyBytes: 32, ivBytes: 16 };
            var dk = keythereum.create(params);
            keythereum.create(params, function (dk) {
                var password = document.getElementById("fname").value;
                var kdf = "pbkdf2";
                var options = {
                    kdf: "pbkdf2",
                    cipher: "aes-128-ctr",
                    kdfparams: {
                        c: 262144,
                        dklen: 32,
                        prf: "hmac-sha256"
                    }
                };
                keythereum.dump(password, dk.privateKey, dk.salt, dk.iv, options, function (keyObject) {
                    document.getElementById("walletAddress").innerHTML = "0x"+keyObject.address
                    document.getElementById("privateKey").innerHTML = dk.privateKey.toString("hex")
                });
            });
        }
    </script>
</body>
</html>